<?php
/**
 * 世界杯竞猜 游戏逻辑模块
 */
namespace WorldCupLast\Controller;
use Common\Controller\CommonController;
class GameController extends CommonController{

    const AppID     =   'wxb2dfa5282782f280';
    const AppSecret =   'a814e9599f2da97118888ebcb447d3f8';

    /**
     * 小组赛
     */
    public function group()
    {
        $data   =   array();
        $this->assign("data",$data);
        $this->display('group');
    }

    /**
     * 游戏配置
     */
    public function config()
    {
        $appid          =  	I('post.appid','','htmlspecialchars');
        $uid            =  	I('post.uid','','htmlspecialchars');
        $data           =   array();
        $data['title']  =   '原来@xxxx才是世界杯的幕后黑手？';
        $data['img']    =   'https://api.beikg.cn/Public/data/worldcuplast/share.jpg';
        if (! empty($appid) && ! empty($uid))
        {

            $table          =   'worldcuplast_member';
            $where          =   array();
            $where['uid']   =   $uid;
            $where['appid'] =   $appid;
            $field          =   array('uid','nickname');
            $result         =   M($table)->where($where)->field($field)->find();

            if (! empty($result))
            {
                $data['title']  =   "原来@{$result['nickname']}才是世界杯的幕后黑手？";
            }
        }
        $this->returnData($data,$msg='ok',$code=200);
    }
}